import i18n from '@/i18n'
import { hasPermission } from '@/utils'
import {
  RenderName,
  RenderJira,
  RenderRead,
  RenderReceived,
  RenderReady,
  RenderEnable,
  RenderAlert,
  RenderEscalation,
  RenderEnableHeader,
  RenderAlertHeader,
  RenderEscalationHeader,
  RenderReadyHeader,
  RenderReceivedHeader,
  RenderReadHeader
} from './element'
import { timeFormat } from '@/components/storybook/utilties/tools'

export const optionList = Object.freeze([
  {
    value: 'Pending',
    label: 'Pending'
  },
  {
    value: 'In Progress',
    label: 'In Progress'
  },
  {
    value: 'Waiting for Dev',
    label: 'Waiting for Dev'
  },
  {
    value: 'Done',
    label: 'Done'
  }
])
export const uatList = Object.freeze([
  {
    value: 'Pending',
    label: 'Pending'
  },
  {
    value: 'Awaiting Response',
    label: 'Awaiting Response'
  },
  {
    value: 'With Feedback',
    label: 'With Feedback'
  },
  {
    value: 'Done',
    label: 'Done'
  }
])

export const sortFields = Object.freeze([
  {
    value: 'name',
    label: 'Name'
  },
  {
    value: 'status',
    label: 'Status'
  },
  {
    value: 'business_type',
    label: 'Type'
  },
  {
    value: 'create_date',
    label: 'Created Date'
  },

  {
    value: 'update_date',
    label: 'Last Modified'
  }
])

export const community = {
  dictLabel: 'Community',
  dictType: null,
  dictValue: 'Community',
  getStartedAboutId: null,
  id: '',
  sort: null,
  subjectCode: '',
  tenantCode: null
}

export const renderColumns = () => [
  {
    field: 'name',
    headerText: i18n.t('custom.bots.name'),
    width: 250,
    clipMode: 'EllipsisWithTooltip',
    template: RenderName
  },
  {
    headerText: i18n.t('custom.reports.integration'),
    autoFit: 130,
    field: 'integrations',
    clipMode: 'EllipsisWithTooltip'
  },
  {
    headerText: i18n.t('custom.reports.classification'),
    autoFit: 130,
    field: 'classification',
    clipMode: 'EllipsisWithTooltip'
  },
  {
    field: 'description',
    headerText: i18n.t('custom.bots.description'),
    width: 150,
    clipMode: 'EllipsisWithTooltip'
  },
  {
    field: 'enable',
    headerText: i18n.t('custom.bots.trigger'),
    width: 100,
    template: RenderEnable,
    headerTemplate: RenderEnableHeader,
    visible: hasPermission('sys:bots:edit')
  },
  {
    field: 'alert',
    headerText: i18n.t('custom.bots.alert'),
    width: 100,
    template: RenderAlert,
    headerTemplate: RenderAlertHeader,
    visible: hasPermission('sys:bots:edit')
  },
  {
    field: 'escalation',
    headerText: i18n.t('custom.bots.escalate'),
    width: 110,
    template: RenderEscalation,
    headerTemplate: RenderEscalationHeader,
    visible: hasPermission('sys:bots:edit')
  },
  {
    field: 'ready',
    headerText: i18n.t('custom.bots.ready'),
    width: 100,
    template: RenderReady,
    headerTemplate: RenderReadyHeader
  },
  {
    field: 'received',
    headerText: i18n.t('custom.bots.received'),
    width: 120,
    template: RenderReceived,
    headerTemplate: RenderReceivedHeader
  },
  {
    field: 'read',
    headerText: i18n.t('custom.bots.read'),
    width: 100,
    template: RenderRead,
    headerTemplate: RenderReadHeader
  },
  {
    field: 'creatorName',
    headerText: i18n.t('custom.bots.createdby'),
    width: 150
  },
  {
    field: 'createTime',
    headerText: i18n.t('custom.bots.createTime'),
    width: 180,
    format: value => timeFormat(value)
  },
  {
    field: 'updateByName',
    headerText: i18n.t('custom.bots.updatedby'),
    width: 150
  },
  {
    field: 'updateTime',
    headerText: i18n.t('custom.bots.updateTime'),
    width: 170,
    format: value => timeFormat(value)
  },
  {
    field: 'jiraNumber',
    headerText: i18n.t('custom.reports.jiraNumber'),
    width: 140,
    clipMode: 'EllipsisWithTooltip',
    template: RenderJira,
    visible: hasPermission('sys:reports:internalNotes')
  },
  {
    field: 'poName',
    headerText: i18n.t('custom.reports.poName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:reports:internalNotes')
  },
  {
    field: 'daName',
    headerText: i18n.t('custom.reports.daName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:reports:internalNotes')
  }
]
